package com.bancomer.batch.pig;

import org.apache.log4j.Logger;

import com.bancomer.batch.pojo.Alert;
import com.bancomer.batch.pojo.FileHelper;
import com.bancomer.batch.pojo.PigScript;
import com.bancomer.batch.util.LinuxCommand;

public class Pig {
	public static void executePigScript(Alert alert) throws Exception{
		Logger logger = Logger.getLogger("Pig");
		String command = "";
		FileHelper parametersFile = alert.getOutputFiles().get(0);
		String pathParametersFile = parametersFile.getLocalPath()+parametersFile.getName();
		PigScript script = alert.getPigScript();
		command = "pig -param_file "+pathParametersFile+" -x mapreduce "+script.getPath()+script.getName();
		LinuxCommand.execute(command,true);
	}
}
